package com.tencent.cloud.iov.recycler.flow;

import com.tencent.cloud.iov.action.IActionListener;
import com.tencent.cloud.iov.flow.presenter.impl.BaseFlowPresenter;
import com.tencent.cloud.iov.recycler.item.IBlockItem;

import java.util.List;

import io.reactivex.Observer;

/**
 * @author showxiao
 * @date 2018/4/18
 */

public abstract class BaseRecyclerPresenter<M extends RecyclerContract.Loader>
        extends BaseFlowPresenter<List<IBlockItem>, M> implements RecyclerContract.Presenter {

    @Override
    protected Observer<List<IBlockItem>> createObserver() {
        return new RecyclerObserver(new IActionListener() {
            @Override
            public boolean onAction(String actionId, Object... args) {
                return getActionListener() != null && getActionListener().onAction(actionId, args);
            }
        });
    }
}
